package com.interview;

import lombok.Data;

import java.util.List;

/**
 * date:
 * description:
 */
public class ParseXml {
    public static void main(String[] args) {
        String input = "";
        String[] entries = input.split("</Query>");
        for(String entry : entries){
            int start = entry.indexOf("<Market>");
            int end = entry.indexOf("</Market>");
            String market = entry.substring(start + "<Market>".length(), end);
            start = entry.indexOf("<Text>");
            end = entry.indexOf("</Text>");
            String text = entry.substring(start + "<Text>".length(), end);
            start = entry.indexOf("<Results>");
            end = entry.indexOf("</Results>");
            String results = entry.substring(start + "<Result>".length(), end);
        }
    }

}

@Data
class Entry{
    String market;
    String text;
    List<Item> results;
}

@Data
class Item{
    String position;
    String title;
    String url;
    String snippet;
}